﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DoAn.DTO;
using System.Data;

namespace DoAn.DAO
{
    public class ChiPhiVanChuyenDAO
    {
        public static void themChiPhiVanChuyen(ChiPhiVanChuyenDTO cp)
        {
            string sql="insert into CHIPHIVANCHUYEN(MaSan,MaPhiVung,CuocPhi,GhiChu) values("
                +cp.MaSan.ToString()+","+cp.MaPhiVung.ToString()+","+cp.CuocPhi.ToString()+",N'"+cp.GhiChu+"')";
            DataProvider.ExcuteQuery(sql);
        }
        public static DataTable laydstheoma(int ma)
        {
            string sql = "select * from CHIPHIVANCHUYEN where MaSan='"+ma.ToString()+"'";
            return DataProvider.DataTable(sql);
        }
        public static DataTable layds3bang(int ma)
        {
            string sql = "select cp.MaSan,ds.TenPhiVung,cp.CuocPhi,cp.GhiChu,vm.TenVung,cp.MaPhiVung from CHIPHIVANCHUYEN cp,DANHSACHPHITHEOVUNG ds,VUNGMIEN vm where cp.MaSan ='" + ma.ToString() + "' and cp.MaPhiVung = ds.MaVung and ds.MaVung = vm.MaVung group by cp.MaSan,ds.TenPhiVung,cp.CuocPhi,cp.GhiChu,vm.TenVung,cp.MaPhiVung";
            return DataProvider.DataTable(sql);
        }
    }
}